import { loginUser } from "@/service/loginRegister";
import { ILoginInfo } from "@/service/loginRegister/types";
import { ActionTree } from "vuex";
import { IUserState } from "./types";
import { IStoreType, IState } from "../types";
const actions: ActionTree<IUserState, IState> = {
  async login(
    { commit },
    payload: ILoginInfo) {
    const res = await loginUser(payload);
    if (res) {
      commit("saveUserInfo", res.data);
    }

    return res;
  },
};

export { actions };
